package com.woniuxy.dr_mall.controller;


import com.woniuxy.dr_mall.entity.DrSpec;
import com.woniuxy.dr_mall.entity.MyResponseEntity;
import com.woniuxy.dr_mall.service.IDrSpecService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author 张哲轩
 * @since 2021-08-11
 */
@RestController
@RequestMapping("/dr_mall/drSpec")
public class DrSpecController {

    @Autowired
    private IDrSpecService specService;


    @GetMapping("getSpecs")
    public MyResponseEntity<List<DrSpec>> getSpecs(int productId){
        return new MyResponseEntity<>(specService.getSpecs(productId));
    }

    @GetMapping("get_by_category")
    public MyResponseEntity<List<DrSpec>> getByCategory(Integer categoryId){
        return new MyResponseEntity<>(specService.getByCategory(categoryId));
    }

}

